﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'V' AND name = 'Enterprises_View')
BEGIN
	DROP  View Enterprises_View
END
GO
CREATE View Enterprises_View AS
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150002'EnterpriseKind FROM ChemicalEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150007'EnterpriseKind FROM CommercialEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,MineLocation Addess,Location,'150004'EnterpriseKind FROM CoalMineEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150006'EnterpriseKind FROM ConstructionEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150003'EnterpriseKind  FROM FireworkEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150005'EnterpriseKind FROM NonCoalMineEnterprise
  UNION
SELECT EnterpriseID,EnterpriseName,Addess,Location,'150008'EnterpriseKind FROM IndustrialEnterprise
  UNION
SELECT EntID EnterpriseID,EntName EnterpriseName,Addess,Region Location,'150001'EnterpriseKind FROM Hazard
GO
